//
//  BaseViewController.m
//  NewProJect2
//
//  Created by rimi on 16/8/24.
//  Copyright © 2016年 Rose. All rights reserved.
//

#import "BaseViewController.h"


@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 1 隐藏系统自带的navigationheaderview
    self.navigationController.navigationBarHidden = YES;
    // 2 加载自定义的背景视图
    [self.view addSubview:self.bgView];
    [self.bgView addSubview:self.leftButton];
    [self.bgView addSubview:self.rightButton];
    [self.bgView addSubview:self.centerLabel];

}

#pragma mark - Button点击事件
-(void)action_LeftButtonClick:(UIButton *)sender{
    [self.navigationController popViewControllerAnimated:YES];
    
}
-(void)action_RightButtonClick:(UIButton *)sender{
    
}

-(UIView *)bgView{
    if (_bgView == nil) {
        _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kwidth, 64)];
        _bgView.backgroundColor = themeColor;
    }
    return _bgView;
}
-(UIButton *)leftButton{
    if (!_leftButton) {
        _leftButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 20, 44, 44)];
        //_leftButton.backgroundColor = [UIColor redColor];
        // 添加图片
        //[_leftButton setImage:[UIImage imageNamed:@"个人中心-left@2x"] forState:UIControlStateNormal];
        [_leftButton addTarget:self action:@selector(action_LeftButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _leftButton;
}
-(UIButton *)rightButton{
    if (!_rightButton) {
        _rightButton = [[UIButton alloc]initWithFrame:CGRectMake(kwidth - 44, 20, 44, 44)];
        //_rightButton.backgroundColor = [UIColor redColor];
        //[_rightButton setImage:[UIImage imageNamed:@"个人中心-right@2x"] forState:UIControlStateNormal];
        [_rightButton addTarget:self action:@selector(action_RightButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _rightButton;
}
-(UILabel *)centerLabel{
    if (_centerLabel == nil) {
        _centerLabel = [[UILabel alloc]initWithFrame:CGRectMake(44, 20, kwidth-88, 44)];
        _centerLabel.textAlignment = NSTextAlignmentCenter;
        _centerLabel.text = @"看你需求自己定义";
        _centerLabel.textColor = [UIColor whiteColor];
    }
    return _centerLabel;
}
@end
